/**
 *Copyright (c) HNA SYSTEMS CO.,LTD
 *
 *@date 2008-10-15
 *
 *Original Author: 陈志钢(zhg_ch)
 *
 *ChangeLog:
 *
 * 
 */
package com.myway.dto.user.domain;
import java.util.HashMap;

/**
 * 
 * @description
 * 
 * UserConstants 用户类型
 * 
 */
public enum UserConstants {

	CARRIER("航空公司"), USER("普通用户"), AGENT("代理人");

	/**
	 * 别名
	 */
	private final String alias;
	private static HashMap<String, UserConstants> map = new HashMap<String, UserConstants>();

	static {
		for (UserConstants e : UserConstants.values()) {
			map.put(e.alias, e);
		}
	}

	/**
	 * @param alias alias
	 */
	UserConstants(String alias) {
		this.alias = alias;
	}

	/**
	 * @return String
	 */
	@Override
	public String toString() {
		return this.alias;

	}

	/**
	 * Return a <code>UserConstants</code> object holding the value of specified alias name
	 * @param alias the alias name of the type
	 * @return a <code>AgentTypeEnum</code> object holding the value represented by the alias name argument
	 */
	public static UserConstants valueOfAlias(String alias) {
		UserConstants type = map.get(alias);

		if (type == null) {
			throw new IllegalArgumentException(
					"Unknown Agent type enum alias [" + alias + "]");
		}

		return type;
	}
}
